<template>
	<view class="card-wrapper">
		<view class="card" v-for="item in commendGoods" :key="item.id" @click="goGoodsDetail(item.id)">
			<image :src="item.img_url"></image>
			<view class="price">
				<text class="light-text">￥{{item.market_price}}</text>
				<text class="unlight-text">￥{{item.sell_price}}</text>
			</view>
			<view class="desc">
				<text>{{item.title}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'commendGoods',
		props: ['commendGoods'],
		methods:{
			goGoodsDetail(id){
				uni.navigateTo({
					url:`/pages/goodsDetail/goodsDetail?id=${id}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.card-wrapper {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		margin: 0 10rpx;

		.card {
			width: 360rpx;
			height: 450rpx;
			background-color: #fff;
			margin: 5rpx 0;
			padding: 15rpx;
			box-sizing: border-box;

			image {
				display: block;
				width: 80%;
				height: 260rpx;
				margin: 10rpx auto;
			}

			.price {
				margin-bottom: 10rpx;

				.light-text {
					color: red;
					font-size: 30rpx;
				}

				.unlight-text {
					color: #bdbdbe;
					margin-left: 30rpx;
					font-size: 24rpx;
					// 文字中间一条线
					text-decoration: line-through;
				}
			}

			.desc {
				font-size: 12px;
			}
		}
	}
</style>
